import Vue from 'vue';
import './styles/iconfont.css';
import './styles/index.scss';
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import App from './test.vue';
import Cookies from 'js-cookie';
import axios from 'axios';
import RsMenu from './components/RsMenu'
import RsTabBar from './components/RsTabBar'
import RsWrap from './components/RsWrap'
import RsIconPicker from './components/RsIconPicker'

//不加这一句，chrome浏览器就算安装了vue插件，也无法在控制台上显示出来
Vue.config.devtools = true;
Vue.use(RsMenu);
Vue.use(RsTabBar);

Vue.use(ElementUI,{
    size: Cookies.get('size') || 'medium', // set element-ui default size
    //locale: enLang // 如果使用中文，无需设置，请删除
});

const service = axios.create({
    baseURL: window.rootPath,
    timeout: 10000,
    headers: {
        'Content-Type': 'application/json;charset=utf-8',
        'X-Requested-With': 'XMLHttpRequest',
        'common':{
            "Accept": "application/json;charset=utf-8"
        }        
    }
    // withCredentials: true, // send cookies when cross-domain requests
});

// request interceptor
service.interceptors.request.use(
    config => {
        //console.log(config)
        return config
    },
    error => {
        return Promise.reject(error)
    }
);
  
// response interceptor
service.interceptors.response.use(

    response => {
        return response;
    },
    error => {
        return Promise.reject(error)
    }
);

Vue.prototype.$req = service;
window.vue = new Vue({
    el: '#app',
    render: (h) => h(App)
});